package com.xxx.corejava.day1216;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.io.IOException;

public class FirstGUI {

    public static void main(String[] args) throws IOException {


        JFrame jf=new JFrame("窗口");


        JButton jb=new JButton("按钮");

        jf.add(jb);



        JButton jb2=new JButton("按钮2");

        jf.add(jb2);


        //设置图标
        jf.setIconImage(ImageIO.read(FirstGUI.class
                                             .getClassLoader()
                                             .getResourceAsStream("com/xxx/corejava/day1216/a.jpg")));

        //设置窗口大小
        jf.setSize(300,200);

        //设置窗口打开位置
        jf.setLocation(300,200);

        //设置窗口可见
        jf.setVisible(true);

        //设置关闭时推出虚拟机
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    }
}
